//Tip:  http://mathworld.wolfram.com/MultinomialCoefficient.html
#include<iostream>
#include<vector>

using namespace std;

int n, k;

double factorial(double n)
{
	double result = 1;
	if(n <= 1)
		return (double)1;
	for(int i=1; i<=n; i++)
		result *= i;
	return result;
}

void read()
{
	double tmp;
	double product, result;
	while(cin >> n >> k)
	{
		product = 1;
		for(int i=0; i<k; i++)
		{
			cin >> tmp;
			product *= factorial(tmp);
		}
		result = factorial(n) / product;
		cout << (int)result << endl;
	}
}

int main()
{
	read();
	return 0;
}
